const user = {
    name: 'jean',
    date: '2019-07-01',
    age: undefined,
    todos: [
        { name: 'go to store', complated: false },
        { name: 'watch movie', complated: true },
        { name: 'running', complated: true }
    ]
}

const template = `
    <ul>
        ${user.todos.map(todo => `
        <li>
            ${todo.name} ${todo.complated ? '√' : 'x'}
        </li>`).join('')}
    </ul>
`

document.body.innerHTML = template;

let name, date, age;
({ name, date, age='18' } = user);
console.log(name);
console.log(date);
console.log(age);

const id = '51030019800730366x';
const fan = 'I love laravist.';
//.startWith()
console.log(id.startsWith('51'));
console.log(id.startsWith('1980', 6));

//.endsWith()
console.log(id.endsWith('x'));
console.log(fan.endsWith('X'));

//.includes()
console.log(fan.indexOf('love') !== -1);
console.log(fan.includes('love'));
console.log(fan.includes('love', 2));

//.repeat()
console.log(`${'⭐'.repeat(5)} ${fan} ${'⭐'.repeat(5)}`);

let a = 10, b = 20;
[a, b] = [b, a];
console.log(a, b);